package com.ssh.tts.dao;

import java.util.List;

import com.ssh.tts.model.IUser;
import com.ssh.utils.DBConnection;

public class UserDao {
	/**
	 * 注册
	 * @param user
	 * @return
	 */
	public int register(IUser user) {
		String sql = "insert into iuser values(user_id.nextval, ?, ?, ?, ?, ?)";
		return DBConnection.update(sql, new Object[] {user.getUSER_NAME(),user.getUSER_PASSWORD(),user.getUSER_SEX(),user.getUSER_IDENTIFIY(),user.getUSER_PHONE()});
	}
	/**
	 * 登陆
	 * @param user
	 * @return
	 */
	public List<IUser> login(IUser user) {
		String sql =  "select * from iuser where user_name = ? and user_password = ?";
		return DBConnection.query(sql, IUser.class, new Object[] {user.getUSER_NAME(), user.getUSER_PASSWORD()});
	}
	
}
